THE AMIGANET BLITZ BASIC FAQ

MISCELLANEOUS

GOSUB VS JSR

Original message by Dimitri Schoolwerth


I also had the problem with gosubs inside an Select/end select routine. Instead of using gosub use JSR (Jump to SubRoutine),it is the same as gosub but then assembly.

If you use JSR ,instead of using return you MUST use RTS (Return From Sub- routine) so here`s a little example:

[setup everything] main: ev.l=WaitEvent select ev case $ case $400 jsr keypresseed case $8000 jsr diskinserted end select jmp main (=jump main,or goto main) keypressed: [code] RTS diskinserted: [do your thingie here] RTS Go to top of page.